<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name=viewport content="width=device-width,initial-scale=1,user-scalable=0">
    <title>领取数量</title>
    <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #top{
            width: 100%;height: 500px;background-color: #999999
        }
        .center{
            width: 100%;text-align: center;height: 33%;background-color: #fdfdfe;float: left;margin-top: 50%
        }
    </style>
</head>
<body>
<div id="top">
    <div class="center">
        <div style="margin-top: 40px">
            <p style="font-size: 13px;color: #169bd5">领取数量:</p>
            <div style="font-weight: bold;margin-top: 8px;line-height: 20px">
                <samp onclick="red()" style="font-size: 18px;margin-right: 10px;color: #169bd5;">-</samp>
                <samp id="sum" style="font-size: 15px;margin-right: 10px">1</samp>
                <samp onclick="adds()" style="font-size: 18px;color: #169bd5;">+</samp>
            </div>
        </div>
        <div style="width: 80%;margin-top: 20px;margin-left: 10%;border-radius: 7px;line-height: 40px;background-color: #169bd5">
            确定
        </div>
    </div>

</div>
<script language="JavaScript">
    function red(){
        var sum = document.getElementById("sum").innerHTML;
        var red = sum-1;
//        alert(red);
        if (red>=0){
            $("#sum").empty().append(red);
        }
    }
    function adds() {
        var obtain = document.getElementById("sum").innerHTML;
        obtain++;
        $("#sum").empty().append(obtain);
    }
</script>
</body>
</html>